package com.app.couponsharelife.ui.dialog

import android.app.Dialog
import android.content.Context
import android.os.Bundle
import android.view.WindowManager
import android.widget.ImageView
import android.widget.TextView
import com.app.couponsharelife.R

/**
 * Created by guluwa on 2018/12/7.
 */
class CouponMoneyIntroduceDialog(context: Context, themeResId: Int, private val type: Int) : Dialog(context, themeResId) {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.coupon_money_profile_dialog)
        initView()
    }

    private fun initView() {
        findViewById<ImageView>(R.id.ivCloseDialog).setOnClickListener { dismiss() }
        findViewById<TextView>(R.id.tvDialogTitle).text = if (type == 1) "券金简介" else "券力值简介"
        findViewById<TextView>(R.id.tvDialogContent).text = if (type == 1) "券金是基于个人在券享生活活动产生的奖励，可用于券享生活的消费、兑换，以及享受相应的券享生活权益等。" else "券力值是用户获得券金币的影响因子，券力值越高，获得的券金币就越多。用户可以通过在券工坊上进行浏览、学习、社交等活动，获得券力值，由于目前券工坊正在前期搭建中，未来将支持更多的券力值获取方式。"

        window!!.setWindowAnimations(R.style.scale_in_alpha_out)
        setCanceledOnTouchOutside(true)

        //设置dialog没有边距
        window!!.decorView.setPadding(0, 0, 0, 0)
        val lp = window!!.attributes
        lp.width = WindowManager.LayoutParams.MATCH_PARENT
        lp.height = WindowManager.LayoutParams.WRAP_CONTENT
        window!!.attributes = lp
    }
}